package com.itheima.project.service.impl;

import com.itheima.project.mapper.CustomerMapper;
import com.itheima.project.pojo.Customer;
import com.itheima.project.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description：用户业务实现接口
 */
@Service("customerService")
public class CustomerServiceImpl implements CustomerService {

    @Autowired
    CustomerMapper customerMapper;

    @Override
    @Transactional
    public Integer saveCustomer(Customer customer) {

        return customerMapper.saveCustomer(customer);
    }

    @Override
    @Transactional
    public Integer updateCustomerById(Customer customer) {
        return customerMapper.updateCustomerById(customer);
    }

    @Override
    @Transactional
    public Integer deleteCustomerById(Integer customerId) {
        return customerMapper.deleteCustomerById(customerId);
    }

    @Override
    public Customer findCustomerById(Integer customerId) {
        return customerMapper.findCustomerById(customerId);
    }

    @Override
    public List<Customer> findCustomerAll() {
        return customerMapper.findCustomerAll();
    }
}
